<script type="text/javascript">
<!--
	$(function(){
		//两级连动
		$("#Category_cate_type").change(function(){
////			alert($(this).val());
			$.getJSON("<?php echo $this->createUrl('children');?>",{'cid':$("#Category_cate_type").val(),"id":"<?php echo isset($_GET['id'])?$_GET['id']:Category::CATEGORY_STORY;?>"},function(msg){
//				alert(msg);
//		var msg = {"7":"\u76f8\u518c","8":"|\uff0d\u6536\u85cf\u7f8e\u56fe","9":"|\uff0d\u592a\u6e56\u7f8e\u666f","11":"|\uff0d\u6f2b\u753b"}		
//				$("#Category_cate_pid").html(msg);
//				dd = "";
				
				var pid = document.getElementById("Category_cate_pid");

				//清除所有已有选项
				while(pid.childNodes.length>0){
					pid.removeChild(pid.childNodes[0]);
				}
				$.each(msg,function(k,v){
//					dd += (k+v);

					
					var option = new Option(v,k);
					pid.options.add(option);
				});
//				alert(dd);
			});
			
		});

//		$("#Category_cate_pid").change(function(){
//			alert($(this).val());
//		});

		$("#cate_submit").button();
		$(".itemsubmit").button();

		//增加分类
		$("#cate_submit").click(function(){
//			alert($("#Category_cate_name").val()+$("#Category_cate_pid").val()+$("#Category_cate_type").val()+$("#Category_cate_order").val()+$(document.getElementsByTagName('iframe')[0].contentWindow.document.body).html());
			$.post('<?php echo $this->createUrl("createremote");?>',{
				'cate_name':$("#Category_cate_name").val(),
				'cate_pid':$("#Category_cate_pid").val(),
				'cate_type':$("#Category_cate_type").val(),
				'cate_order':$("#Category_cate_order").val(),
				'cate_des':$(document.getElementsByTagName('iframe')[0].contentWindow.document.body).html(),
				'self':1
			},function(msg){
//				alert(msg);
				$(msg).insertBefore($("#categoryList>li:eq(0)"));
			});
		});

		$(".itemlist").hover(function(){
//			alert("KKK");
			$(this).children(".quick").fadeIn();
		},function(){
			$(this).children(".quick").fadeOut();
		});

		$(".quickshow").click(function(){
			$(this).parent().siblings(".showitem").slideToggle();
			return false;
		});

		$(".quickshow").next().next().click(function(){			
			item = $(this).parent().parent();
			
//			alert(this.href);
			id = $(this).parent().siblings("input").val();
//			alert(id);
			$.post(this.href,{'id':id,'ajax':1},function(msg){
//				alert(msg);
				if(id == msg){
					item.css({"background-color":"yellow"}).fadeOut();
				}
				
			});
			return false;
		});
		
 	});



//-->
</script>
<div class="column1">
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('admin','Statistics')));?>
				<div class="box-content">
				<?php echo $this->renderPartial('_form', array('model'=>$model,'cate'=>$cate)); ?>
				</div>
		<?php $this->endWidget();?>
	</div>
</div>
<div class="column2">
	<div class="box">
		<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>Yii::t('admin','Statistics')));?>
			<div class="box-content">
				<ul id="categoryList">
			<?php /*		<?php foreach ($cate as $k=>$v):?>
					<li><input type="checkbox" name="category" value="<?php echo $k;?>" />&nbsp;&nbsp; <?php echo $v;?></li>
					<?php endforeach;?>
				*/
			?>	
				<?php 
//		$this->widget('zii.widgets.CListView', array(
//			'dataProvider'=>$cateModel,
//			'itemView'=>'_item',
//		)); 
//					$this->renderPartial('_item',array('cate'=>$cateModel));
				?>
			
				</ul>
		</div>
		<?php $this->endWidget();?>
	</div>
</div>

